$(function() {
	//接受传递过来的id
	//先遍历传过来的每一条存储数据
	var histroyArr = [];
	for (var i = 0; i < localStorage.length; i++) {
		// console.log('localStorage.key(i)', localStorage.key(i)); //localStorage.key(i)  键名！！！

		if (localStorage.key(i).includes("favorite")) { // 如果该键名包含favorite
			histroyArr.push(localStorage.getItem(localStorage.key(i)));
			//则获取到该键名的键值  将其push到一个新的数组
		}
	}
	// console.log(histroyArr);
	histroyArr.forEach(function(v1, i) {
		// console.log('v1', v1);
		//遍历我想要的数组  v就是我想要渲染数据的索引
		console.log(indexjson[v1]);
		var data = indexjson[v1].goodsList[0];
		// indexjson[v1].forEach(function(v2, i) {
		// console.log('v2', v2);
		// console.log(indexjson[v1]);
		$('.exhAreaUl').append($(
			'<li class="exhAreaLi"><div class="exhAWrap"><div class="exhA-img"><a href="javascript:;"><img src="' +
			data.Commodityurl +
			'"></a></div><div class="sider"><ul></ul></div><div class="exhA-lie"><div class="exhA-price">' +
			data.newprice + '</div><div class="exhA-num">已售<em>' + data.solds +
			'</em>件</div></div><div class="exhA-name"><a href="javascript:;" title="' +
			data
			.gname + '">' + data
			.gname +
			'</a></div><div class="exhA-store"><a href="javascript:;" title="' + data.service +
			'" class="store">' + data
			.service +
			'</a><a href="javascript:;" class="icon-kefu"></a></div><div class="label"></div><div class="exhA-operate"><a href="javascript:;" class="compareLink"><input type="checkbox" class="comparison"><label class="exhA-label" for=""></label>对比</a><a href="javascript:;" class="icon-aixin">收藏</a><a href="javascript:;" class="shop icon-shop">加入购物车</a></div></div></li>'
		))
	})
	// console.log('v', indexjson[v]);

	// var indarr = histroyArr.filter(function() {
	// 	return histroyArr.includes('favorite')
	// })
	// console.log(indarr);
	// console.log(histroyArr);
	// 渲染展示区

})
